import React, { useState, useEffect } from "react";
import { Input, Modal, Form } from "antd";
import UploadImg from "../UploadAvatar";
import style from "./style.module.css";

function DialogCom(props) {
  const { isShow, info } = props;
  // const [title, setTitle] = useState("");
  // const [price, setPrice] = useState("");
  // const [inventory, setInventory] = useState("");

  // useEffect(() => {
  //   setTitle(info.title);
  //   setPrice(info.price);
  //   setInventory(info.inventory);
  // }, []);

  return (
    <div>
      <Modal
        title="编辑商品"
        visible={isShow}
        onOk={props.handleOk}
        onCancel={props.handleCancel}
      >
        <Form name="basic">
          <Form.Item label="商品名称" name="title">
            <Input value={info.title} />
          </Form.Item>
          <Form.Item label="商品售价" name="price">
            <Input value={info.price} />
          </Form.Item>
          <Form.Item label="商品售价" name="price">
            <UploadImg />
          </Form.Item>
          <Form.Item label="商品库存" name="inventory">
            <Input value={info.inventory} />
          </Form.Item>
        </Form>
      </Modal>
    </div>
  );
}

export default DialogCom;
